﻿using System;
using System.Collections.Generic;
using System.ServiceModel.Syndication;
using RecruitmentAgency.Models.DataTypes;

namespace RecruitmentAgency.Models.DataProviders
{
    /// <summary>
    /// Provides database access for CV data
    /// </summary>
    public interface ICvDataProvider
    {
        /// <summary>
        /// Adds a PersonEmployment instance to the database
        /// </summary>
        /// <param name="personEmployment">The PersonEmployment instance to add to the database</param>
        void AddEmployment(PersonEmployment personEmployment);

        /// <summary>
        /// Adds a PersonQualification instance to the database
        /// </summary>
        /// <param name="personQualification">The PersonQualification instance to add to the database</param>
        void AddQualification(PersonQualification personQualification);

        /// <summary>
        /// Adds a PersonReferee instance to the database
        /// </summary>
        /// <param name="personReferee">The PersonReferee instance to add to the database</param>
        void AddReferee(PersonReferee personReferee);

        /// <summary>
        /// Adds a PersonSkill instance to the database
        /// </summary>
        /// <param name="personSkill">The PersonSkill instance to add to the database</param>
        void AddSkill(PersonSkill personSkill);

        /// <summary>
        /// Deletes the employment record that relates to the input employmentId parameter
        /// </summary>
        /// <param name="employmentId">The ID number of the employment record to delete</param>
        void DeleteEmployment(int employmentId);

        /// <summary>
        /// Deletes the person and all related details from the database that relates to the input personId parameter
        /// </summary>
        /// <param name="personId">The ID number of person to delete</param>
        void DeletePerson(int personId);

        /// <summary>
        /// Deletes the qualification record that relates to the input qualificationId parameter
        /// </summary>
        /// <param name="qualificationId">The ID number of the qualification record to delete</param>
        void DeleteQualification(int qualificationId);

        /// <summary>
        /// Deletes the referee record that relates to the input refereeId parameter
        /// </summary>
        /// <param name="refereeId">The ID number of the referee record to delete</param>
        void DeleteReferee(int refereeId);

        /// <summary>
        /// Deletes the skill record that relates to the input skillId parameter
        /// </summary>
        /// <param name="skillId">The ID number of the skill record to delete</param>
        void DeleteSkill(int skillId);

        /// <summary>
        /// Gets all types of authority to work from the database
        /// </summary>
        /// <returns>A list of types of authority to work</returns>
        List<string> GetAuthorityToWork();

        /// <summary>
        /// Gets all contact preferences from the database
        /// </summary>
        /// <returns>A list of contact preferences</returns>
        List<string> GetContactPreferences();

        /// <summary>
        /// Gets a System.ServiceModel.Syndication.SyndicationFeed full of CV data
        /// </summary>
        /// <param name="homePageUri">The URI of the page to go to when the user clicks the RSS feed title link</param>
        /// <returns>A System.ServiceModel.Syndication.SyndicationFeed full of CV data</returns>
        SyndicationFeed GetCvRssFeed(string homePageUri);

        /// <summary>
        /// Gets all grade choices from the database
        /// </summary>
        /// <returns>All grade choices</returns>
        List<string> GetGrades();

        /// <summary>
        /// Gets a PersonalDetail instance that relates to the provided PersonId
        /// </summary>
        /// <param name="personId">The ID number of the user whose personal details are required</param>
        /// <returns>A PersonalDetail instance</returns>
        PersonalDetail GetPersonalDetail(int personId);

        /// <summary>
        /// Gets a PersonalDetail instance that relates to the provided username
        /// </summary>
        /// <param name="username">The username of the user whose personal details are required</param>
        /// <returns>A PersonalDetail instance</returns>
        PersonalDetail GetPersonByUsername(string username);

        /// <summary>
        /// Gets a list of PersonEmployment instances that relate to the provided PersonId
        /// </summary>
        /// <param name="personId">The ID number of the user whose employment record is required</param>
        /// <returns>A list of PersonEmployment instances</returns>
        List<PersonEmployment> GetPersonEmployment(int personId);

        /// <summary>
        /// Gets the ID number of the Person that relates to the provided username
        /// </summary>
        /// <param name="username">The username of the user whose personal details are required</param>
        /// <returns>The ID number of the Person that relates to the provided username</returns>
        int GetPersonIdByUsername(string username);
        
        /// <summary>
        /// Gets a List of PersonQualification instances that relate to the provided PersonId
        /// </summary>
        /// <param name="personId">The ID number of the user whose qualification record is required</param>
        /// <returns>A List of PersonQualification instances</returns>
        List<PersonQualification> GetPersonQualifications(int personId);

        /// <summary>
        /// Gets a List of PersonReferee instances that relate to the provided PersonId
        /// </summary>
        /// <param name="personId">The ID number of the user whose referees record is required</param>
        /// <returns>A List of PersonReferee instances</returns>
        List<PersonReferee> GetPersonReferees(int personId);

        /// <summary>
        /// Gets a List of PersonQualification instances that relate to the provided PersonId
        /// </summary>
        /// <param name="personId">The ID number of the user whose skill record is required</param>
        /// <returns>A List of PersonSkill instances</returns>
        List<PersonSkill> GetPersonSkills(int personId);

        /// <summary>
        /// Gets all proficiency levels from the database
        /// </summary>
        /// <returns>List of proficiency levels></returns>
        List<string> GetproficiencyLevels();

        /// <summary>
        /// Gets all qualification type choices from the database
        /// </summary>
        /// <returns>List of qualification types</returns>
        List<string> GetQualificationTypes();

        /// <summary>
        /// Gets all relationship choices from the database
        /// </summary>
        /// <returns>List of relationship choices</returns>
        List<string> GetRelationships();

        /// <summary>
        /// Gets all industry sector names from the database
        /// </summary>
        /// <returns>A list of industry sector names</returns>
        List<string> GetSectors();

        /// <summary>
        /// Gets all titles from the database
        /// </summary>
        /// <returns>List of string titles></returns>
        List<string> GetTitles();

        /// <summary>
        /// Gets unique users' qualification subject names from the database
        /// </summary>
        /// <returns>A list of unique users' qualification subject names</returns>
        List<string> GetUniqueQualificationSubjectNames();

        /// <summary>
        /// Gets unique users' qualification type names from the database
        /// </summary>
        /// <returns>A list of unique users' qualification type names</returns>
        List<string> GetUniqueQualificationTypeNames();

        /// <summary>
        /// Gets unique users' preferred job sector names from the database
        /// </summary>
        /// <returns>A list of unique users' preferred job sector names</returns>
        List<string> GetUniqueSectorPreferences();

        /// <summary>
        /// Gets unique users' skill names from the database
        /// </summary>
        /// <returns>A list of unique users' skill names</returns>
        List<string> GetUniqueSkillNames();

        /// <summary>
        /// Gets all of the verification type names from the database
        /// </summary>
        /// <returns>All of the verification type names</returns>
        List<string> GetVerificationTypes();

        /// <summary>
        /// Gets the person detail results and paging data
        /// </summary>
        /// <param name="pageSize">The number of rows of results to a page</param>
        /// <param name="pageNumber">The number of the page of results to return</param>
        /// <param name="minimumNumberOfGcse">The minimum number of GCSEs to search for</param>
        /// <param name="minimumNumberOfAlevel">The minimum number of A-Levels to search for</param>
        /// <param name="jobSectorPreference">The job sector preference of the user to search for</param>
        /// <param name="qualificationType">The type of qualification of the user to search for</param>
        /// <param name="qualificationSubject">The qualification subject of the user to search for</param>
        /// <param name="skillName">The name of the skill of the user to search for</param>
        /// <param name="personName">The name of the user to search for</param>
        /// <returns>A CvSearchData instance that holds the person detail results, paging data and the number of records that need verifying for each person</returns>
        CvSearchData SearchCvs(int pageSize, int pageNumber, int? minimumNumberOfGcse, int? minimumNumberOfAlevel, string jobSectorPreference, string qualificationType, string qualificationSubject, string skillName, string personName);

        /// <summary>
        /// Updates the record in the database that relates to the PersonId property of the supplied PersonEmployment instance with the details in the PersonEmployment
        /// </summary>
        /// <param name="personEmployment">The PersonEmployment instance to update</param>
        void UpdateEmployment(PersonEmployment personEmployment);

        /// <summary>
        /// Updates the record in the database that relates to the PersonId property of the supplied PersonalDetail instance with the details in the PersonalDetail
        /// </summary>
        /// <param name="personDetail">The PersonalDetail instance to update</param>
        void UpdatePersonDetails(PersonalDetail personDetail);

        /// <summary>
        /// Updates the record in the database that relates to the PersonId property of the supplied PersonQualification instance with the details in the PersonQualification
        /// </summary>
        /// <param name="personQualification">The PersonQualification instance to update</param>
        void UpdateQualification(PersonQualification personQualification);

        /// <summary>
        /// Updates the record in the database that relates to the PersonId property of the supplied PersonReferee instance with the details in the PersonReferee
        /// </summary>
        /// <param name="personReferee">The PersonReferee instance to update</param>
        void UpdateReferee(PersonReferee personReferee);

        /// <summary>
        /// Updates the record in the database that relates to the PersonId property of the supplied PersonSkill instance with the details in the PersonSkill
        /// </summary>
        /// <param name="personSkill">The PersonSkill instance to update</param>
        void UpdateSkills(PersonSkill personSkill);
    }
}